<%@page import="entities.CommentEntity"%>
<%@page import="service.CommentService"%>
<%@page import="entities.CommentCount"%>
<%@page import="service.SellerService"%>
<%@page import="entities.SellerEntity"%>
<%@page import="util.Util"%>
<%@page import="service.TgoodsService"%>
<%@page import="entities.TgoodsEntity"%>
<%@ page language="java" import="java.util.*,java.math.BigDecimal;"
	pageEncoding="utf-8"%>
<%
	String tgoodsId = request.getParameter("tgoodsId");
	//商品实体
	TgoodsEntity tgoods = null;
	//商家实体
	SellerEntity seller = null;
	//获得评论信息
	CommentCount comment_count = null;
	if (tgoodsId != null) {
		tgoods = TgoodsService.getPointTgoods(Integer.parseInt(tgoodsId));
		seller = SellerService.getSellerById(tgoods.getTgSeId());
	}
%>
<!DOCTYPE HTML >
<html>
<head>
<title><%=tgoods.getTgName()%></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/GlobalFunction.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/goodsDetail.css">
<style type="text/css">
/* star即时评分 */
#star {
	position: relative;
	width: 600px;
	margin: 5px 0 0 0;
	height: 28px;
}

#star ul,#star span {
	float: left;
	display: inline;
	height: 19px;
	line-height: 19px;
}

#star ul {
	margin: 0 6px;
}

#star li {
	float: left;
	width: 24px;
	cursor: pointer;
	text-indent: -9999px;
	background: url(images/star.png) no-repeat;
}

#star strong {
	color: #f60;
	padding-left: 10px;
}

#star li.on {
	background-position: 0 -28px;
}

#star p {
	font-size: 12px;
	position: absolute;
	top: 20px;
	line-height: 16px;
	width: 159px;
	height: 60px;
	display: none;
	background: url(images/icon.gif) no-repeat;
	padding: 10px 10px 0;
}

#star p em {
	color: #f60;
	display: block;
	margin-bottom: 2px;
	font-style: normal;
}

.buy{
	display: block;
	cursor:pointer;
	width: 120px;
	height: 38px;
	float: right;
	margin-left: 100px;
	background: #690;
	text-align: center;
	font-size: 18px;
	font-weight: bold;
	color: white;
}
.buy :hover {
	display: block;
	cursor:pointer;
	width: 120px;
	height: 38px;
	float: right;
	margin-left: 100px;
	background: red;
	text-align: center;
	font-size: 18px;
	font-weight: bold;
	color: white;
}
</style>

</head>

<body>
	<jsp:include page="header.jsp"></jsp:include>
	<div id="goodsId" style="height: 20px;visibility: hidden;"><%=tgoodsId%></div>
	<div id="userName" style="display: none;"><%=session.getAttribute("userName")%></div>
	
	<div id="goodsType" style="display: none;">tuangou</div>
	
	<div id="content">
		<div class="layer" id="mblogdetail">
			<div class="tube tube-a">
				<div class="block" id="detailcnt">
					<div class="center">
						<div class="section">
							<div class="userinfo clr">
								<!-- 商家图片 -->
								<a class="avatar" href="javascript:;"> <img
									src="<%=seller.getLogoURL()%>" width="80"
									height="48"> </a>
								<!-- 商品所属商家-->
								<h2>
									本商品来自 <a class="name" href="javascript:;"
										title="<%=seller.getName()%>"><%=seller.getName()%></a> <span>
										，发布于 </span><i><%=tgoods.getTgSaTim()%></i>
								</h2>
							</div>
							<div class="article clr" id="article">
								<div class="detailinfo" id="detailinfo">
									<p class="detail">
										<!-- 商品图片 -->
										<a class="shownext" href="javascript:;"
											title="<%=tgoods.getTgName()%>"> <img
											src="<%=tgoods.getTgImage()%>" height="366"
											width="466"> </a>
									</p>
									<!-- 商品介绍 -->
									<div class="desc">
										<i class="ql">&nbsp;</i> 简介：
										<h1><%=tgoods.getTgDesc()%></h1>
									</div>
								</div>
								<div class="goodsInfo">
									<div class="goodsName">
										<%=tgoods.getTgName()%> 
										<br/>
										<font style="font-size: 18px;color:#690;font-weight:bold;"> 已团购：</font><span class="saleCount"><%=tgoods.getTgSaCou()%></span>
									</div>
									<div class="info_d">
										类别：<span><%=tgoods.getClassName()%></span>
									</div>
									<div class="info_d">
										关键字：<span><%=tgoods.getTgKeyWo()%></span>
									</div>
									
									<div class="info_d">
										截止日期：<span><%=tgoods.getTgDeadline()%></span>
									</div>
									
									<div class="info_d">
										<span style="color:#690;font-size: large;font-weight: bold;">￥100.0 </span><span>原价：50</span>
										
									</div>
									<div class="info_d">
										<!-- JiaThis Button BEGIN -->
										分享到：
										<div style="border: none;" class="jiathis_style">
											<span class="jiathis_txt">&nbsp;&nbsp;</span><a
												class="jiathis_button_icons_1"></a> <a
												class="jiathis_button_icons_2"></a> <a
												class="jiathis_button_icons_3"></a> <a
												class="jiathis_button_icons_4"></a> <a
												href="http://www.jiathis.com/share"
												class="jiathis jiathis_txt jtico jtico_jiathis"
												target="_blank"></a> <a class="jiathis_counter_style"></a>
										</div>

										<script type="text/javascript">
											var jiathis_config = {
												url : "www.baidu.com",
												summary : "哈哈哈哈",
												title : "外卖街 #发的身份#",
												hideMore : false
											}
										</script>
										<script type="text/javascript"
											src="http://v3.jiathis.com/code/jia.js?uid=1360374582471645"
											charset="utf-8"></script>
										<!-- JiaThis Button END -->
									</div>
									<div style="border-bottom: none;">
									<a href="javascript:void(0); return false;" title='<%=(session.getAttribute("userName")==null)?"请登录后购买":"购买" %>' class="buy" id="buy"><font style="color:white;">立即抢购</font></a>
									</div>
								</div>
							</div>
							
						</div>
					</div>
				</div>

			</div>
			<div class="tube tube-b">
				<div class="block">
					<div class="otheralbums">
						<h4>同类商品推荐 &gt;&gt;</h4>
						<ul class="oblbums">
						<%  List<TgoodsEntity> gClsList = new ArrayList<TgoodsEntity>();
							gClsList = TgoodsService.getClassGoods(tgoods.getTgClaId()+"", "3");	
						    for(TgoodsEntity g : gClsList){
						 %>
							<li><a class="obimg" href="tgdetail.jsp?tgoodsId=<%=g.getTgId()%>"> <img src="<%=g.getTgImage() %>"
									width="64" height="64" alt="<%=g.getTgName()%>"> </a> <a class="db"
								href="tgdetail.jsp?tgoodsId=<%=g.getTgId()%>" title="<%=g.getTgName()%> "><%=g.getTgName()%> </a>
								<div class="clr">
									<span class="sale"> 销售：</span><span class="saleCount"><%=g.getTgSaCou()%></span>
								</div>
							</li>
						<%} %>
						</ul>
					</div>
					<div style="height: 30px;"></div>
					<div class="otheralbums">
						<h4>猜你喜欢 &gt;&gt;</h4>
						<%  
						List<TgoodsEntity> tgHotGoods = new ArrayList<TgoodsEntity>();
							tgHotGoods = TgoodsService.getHotGoods();
						    for(TgoodsEntity g : tgHotGoods)
						    {
						 %>
						<ul class="oblbums">
							<li><a class="obimg" href="tgdetail.jsp?tgoodsId=<%=g.getTgId()%>"> <img src="<%=g.getTgImage() %>"
									width="64" height="64" alt="<%=g.getTgName()%>"> </a> <a class="db"
								href="tgdetail.jsp?tgoodsId=<%=g.getTgId()%>" title="<%=g.getTgName()%> "><%=g.getTgName()%> </a>
								<div class="clr">
									<span class="sale"> 销售：</span><span class="saleCount"><%=g.getTgSaCou()%></span>
								</div>
							</li>
						<%} %>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="footer.jsp"></jsp:include>
	<script type="text/javascript">
	$(document).ready(function(){		
		$("#buy").click(function(){
			var goodsId=$("#goodsId").html().trim();
			var userName = $("#userName").html().trim();
			tbuy(userName,goodsId);//buy函数写在GlobalFunction中
		});
	});
	</script>
</body>
</html>
